package com.tgu.home_action.pojo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

@Data
@ApiModel(description = "案件")
public class Case implements Serializable {
    public interface insert {
    }

    public interface volunteer {
    }

    public interface familyCase {
    }

    public interface oldManCase {
    }

    @ApiModelProperty("案件ID")
    private Integer id;
    @NotNull(message = "province不能为空", groups = {insert.class})
    @ApiModelProperty("省")
    private String province;
    @NotNull(message = "city不能为空", groups = {insert.class})
    @ApiModelProperty("市")
    private String city;
    @NotNull(message = "district不能为空", groups = {insert.class})
    @ApiModelProperty("区")
    private String district;
    @NotNull(message = "address不能为空", groups = {insert.class})
    @ApiModelProperty("详细地址")
    private String address;
    @NotNull(message = "place不能为空")
    @ApiModelProperty("位置名")
    private String place;
    @NotNull(message = "longitude不能为空", groups = {insert.class})
    @ApiModelProperty("走失点经度")
    private Double longitude;
    @NotNull(message = "latitude不能为空", groups = {insert.class})
    @ApiModelProperty("走失点纬度")
    private Double latitude;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "走失时间", dataType = "java.sql.Date")
    private Timestamp lostTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "案件开始时间", dataType = "java.sql.Date")
    private Timestamp startTime;
    @ApiModelProperty("其它信息")
    private String others;
    @NotNull(message = "familyId不能为空", groups = {familyCase.class})
    @ApiModelProperty("家属ID")
    private Integer familyId;
    @NotNull(message = "oldManId不能为空", groups = {insert.class, oldManCase.class})
    @ApiModelProperty("老人信息ID")
    private Integer oldManId;
    @ApiModelProperty("案件状态（1为正在进行，2为已找到，3为已超时,4为已取消）")
    private Short state;
    private OldMan oldMan;
    @JsonIgnore
    private String gis;
    @ApiModelProperty("案件发生地距自己的距离")
    private Double distance;
    @ApiModelProperty("志愿者-案件信息")
    private VolunteerCase volunteerCase;
    @ApiModelProperty("家属")
    private Family family;
    @JsonBackReference("当前页")
    @ApiModelProperty("当前页")
    private Integer pageNo;
    @JsonBackReference("每页条数")
    @ApiModelProperty("每页条数")
    private Integer pageSize;
    @JsonBackReference("appId")
    @ApiModelProperty("appId")
    private String appId;
    @JsonBackReference("accessKey")
    @ApiModelProperty("accessKey")
    private String accessKey;
    @JsonBackReference("志愿者ID")
    @ApiModelProperty("志愿者ID")
    @NotNull(message = "volunteerId不能为空", groups = {volunteer.class})
    private Integer volunteerId;
    @ApiModelProperty("完成时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp endTime;

    /**
     * 分页查询前面的数据
     */
    @JsonIgnore
    private Integer startSize;

    public Case() {
    }

    public Case(Integer id, Integer familyId, Short state) {
        this.id = id;
        this.familyId = familyId;
        this.state = state;
    }
}
